package com.faxsun.profile.core.domain;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.broadleafcommerce.profile.core.domain.Customer;
import org.broadleafcommerce.profile.core.domain.CustomerImpl;

import org.hibernate.annotations.Index;

@Entity
@Inheritance(strategy = InheritanceType.JOINED)
@Table(name = "FS_THIRD_PARTY_CUSTOMER")
public class FSThirdPartyCustomerImpl implements FSThirdPartyCustomer {
	
	/*
	 * 第三方用户的userID 或者 设备号的UUID。
	 */
	@Id
	@Column(name = "USER_ID_3TH")
	protected String uid;
	
	@Column(name = "CHANNEL_ID_3TH")
	protected String channelId;
	
	@ManyToOne(targetEntity = CustomerImpl.class, optional=false)
    @JoinColumn(name = "CUSTOMER_ID", nullable = false)
    @Index(name="ORDER_CUSTOMER_INDEX", columnNames={"CUSTOMER_ID"})
    protected Customer customer;

	/**
	 * 微信的unionId，用户身份唯一标识
	 */
	@Column(name="UNION_ID")
	protected String unionId;
	
	@Column(name="AVATAR")
	protected String avatar;
	
	@Column(name="NICKNAME")
	protected String nickName;
	
    @Override
    public Customer getCustomer() {
        return customer;
    }

    @Override
    public void setCustomer(Customer customer) {
        this.customer = customer;
    }

	@Override
	public String getChannelId() {	
		return channelId;
	}

	@Override
	public void setChannelId(String channelId) {
		 this.channelId = channelId;
	}

	@Override
	public void setUid(String uid) {
		this.uid = uid;
	}

	@Override
	public String getUid() {
		return uid;
	}

	@Override
	public String getUnionId() {
		return unionId;
	}

	@Override
	public void setUnionId(String unionId) {
		this.unionId = unionId;
	}

	@Override
	public String getAvatar() {
		return avatar;
	}

	@Override
	public void setAvatar(String avatar) {
		this.avatar = avatar;
	}

	@Override
	public String getNickName() {
		return nickName;
	}

	@Override
	public void setNickName(String nickName) {
		this.nickName = nickName;
	}

	
}
